import request, { ApiResponse } from '../utils/request';

export interface LoginParams {
  username: string;
  password: string;
  sysCode: string;
}

export interface LoginData {
  token?: string;
  user?: any;
}

export type LoginResponse = ApiResponse<LoginData>;

// 登录API
export const login = (params: LoginParams): Promise<any> => {
  return request({
    url: '/auth/cms/login',
    method: 'post',
    data: params,
  });
};

// 退出登录API
export const logout = (): Promise<any> => {
  return request({
    url: '/auth/cms/logout',
    method: 'get',
  });
};

// 获取用户信息API
export const getUserInfo = (): Promise<any> => {
  return request({
    url: '/auth/cms/user/info',
    method: 'get',
  });
}; 